"""
21 - Dars
"""


WORDS = ['мадам', 'топот', 'test', 'madam', 'word']
PALINDROMES = []

# 1 - usul.
for word in WORDS:
    if word == word[::-1]:
        PALINDROMES.append(word)

# 2 - usul.
PALINDROMES1 = []
PALINDROMES1 = [word for word in WORDS if word == word[::-1]]

print(PALINDROMES)
print(PALINDROMES1)

# 3 - usul.
MY_STR = ['Око за око', 'А роза упала на лапу Азора', 'Около Миши молоко']
PALINDROMES = []
for word in MY_STR:
    WORD_R = word.replace(' ', '').lower()
    if WORD_R == WORD_R[::-1]:
        PALINDROMES.append(word)

print(PALINDROMES)

L = list(range(1, 10))
L2 = list('hello')

print(L, L2, type(L))

# join - orasiga narsa qo'shadi.
# map - ro'yxatni stringa aylantirayapti.
S = '-'.join(map(str, L))
S2 = ','.join(L2)

print(S, type(S))
print(S2, type(S2))
